# Forked from Alpine for update to 2.19.1. Without this, KDE's extra-cmake-modules
# currently does not compile. See https://github.com/alpinelinux/aports/pull/4533
# for details. This aport can be removed, when that PR is merged.

pkgname=py-requests
_pkgname=requests
pkgver=2.19.1
pkgrel=0
pkgdesc="A HTTP request library for Python"
url="http://www.python-requests.org/"
arch="noarch"
license="Apache-2.0"
# Requirements for tests are not available in main
options="!check"
depends="py-chardet py-idna py-certifi py-urllib3"
makedepends="python2-dev py-setuptools python3-dev"
subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	python2 setup.py build
	python3 setup.py build
}

package() {
	mkdir -p "$pkgdir"
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc ${python#python}"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

sha512sums="deef2662227497b472f6e7eb7f0ee468c772069fc66552f71d80e5a12af62a187f8bc6a8a78531915e824c7f277d0db61c1534c89d13d473f68504f0bd6edf47  requests-2.19.1.tar.gz"
